package com.kitty.game.market.model;

import lombok.Data;

@Data
public class MarketTransactionRecord {

    /**
     * 0为买，1为卖
     */
    private byte type;

    private String name;

    private short level;

    private int time;

    private int endTime;

    private int price;

    private short status;

    private short amount;

    private short req_level;

    private byte item_polar;

    private String record_id;

    public static MarketTransactionRecord valueOf(Goods goods) {
        MarketTransactionRecord record = new MarketTransactionRecord();
        record.setAmount((short) goods.getNumber());
        record.setEndTime((int) (goods.getEndTime().getTime()/1000));
        record.setLevel(goods.getLevel());
        record.setName(goods.getName());
        record.setPrice(goods.getPrice());
        record.setRecord_id(goods.getMianbanId());
        record.setStatus((short) 2);
        record.setTime((int) (System.currentTimeMillis()/1000));
        return record;
    }

}
